﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript">
    var deptAddSetting = {};
    $(function() {
        var nodes = $("#deptNodes").val();
        $.fn.zTree.init($("#deptAddzTree"), deptAddSetting, eval(nodes));
    })

    function proRes(ajaxContext) {
        var restag = {};
        try {
            restag = ajaxContext.get_response().get_object();
        } catch (e) {
            alert("程序出现错误，请联系管理员");
            return;  // return if result is not json
        }

        if (restag.res != true) {
            alert(restag.msg);
        }
        else {
            alert("操作成功");
            $('#menu_alldeptlist').trigger('click');
            $.fn.deltab('7-1');
        }
    }
</script>

<div>
    <div style="padding-left: 10px; width: 1080px;">
        <div class="leftLand">
            <%using (Ajax.BeginForm("DoDeptAdd", "Basic", new AjaxOptions { UpdateTargetId = "temp", OnSuccess = "proRes" }))
              { %>
            <input type="submit" value="添加" style="margin-top: 5px;" /><br />
            <p style="margin: 10px 0;">
                上级部门:<%=Html.DropDownList("pardeptList", null, new { @style = "width:282px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0;">
                部门名称:<%=Html.TextBox("deptName", "", new { @style = "width:280px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0;">
                部门分类:<%=Html.TextBox("deptCatal", "", new { @style = "width:280px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0; height: 100px;">
                <span style="float: left;">部门描述:</span> <span style="float: left;">
                    <%=Html.TextArea("deptDescn", "", new { @style = "width:268px; height:85px; margin-left:8px;border-radius:0px 0px 0px 0px; border:solid 1px #6C92AD;" })%></span></p>
            <%} %>
        </div>
        <div class="rightLand" style="margin-top: 40px;">
            <div id="deptAddzTree" class="ztree">
            </div>
            <input type="hidden" id="deptNodes" value="<%=ViewData["pardept"] %>" />
        </div>
    </div>
</div>
